﻿package mortal.game.view.common.menu
{
    import fl.controls.listClasses.*;
    import flash.display.*;
    import flash.events.*;
    import flash.text.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.component.gconst.*;
    import mortal.game.resource.*;

    public class PlayerMenuCellRenderer extends CellRenderer
    {
        private var _textFormat:TextFormat;

        public function PlayerMenuCellRenderer()
        {
            this._textFormat = new GTextFormat(null, 12, 16777215, null, null, null, null, null, TextFormatAlign.CENTER);
            var _loc_1:* = ResourceConst.getScaleBitmap(ImagesConst.Menu_overSkin);
            setSize(95, 19);
            this.setStyle("downSkin", new Bitmap());
            this.setStyle("overSkin", _loc_1);
            this.setStyle("upSkin", new Bitmap());
            this.setStyle("selectedDownSkin", new Bitmap());
            this.setStyle("selectedOverSkin", _loc_1);
            this.setStyle("selectedUpSkin", new Bitmap());
            this.setStyle("textFormat", new GTextFormat(null, 12, 16777215, null, null, null, null, null, TextFormatAlign.CENTER));
            this.setStyle("disabledTextFormat", new GTextFormat(null, 12, 16777215, null, null, null, null, null, TextFormatAlign.CENTER));
            this.addListeners();
            return;
        }// end function

        private function addListeners() : void
        {
            this.addEventListener(MouseEvent.MOUSE_OVER, this.MouseHandler);
            this.addEventListener(MouseEvent.MOUSE_OUT, this.MouseHandler);
            return;
        }// end function

        private function MouseHandler(event:MouseEvent) : void
        {
            if (event.type == MouseEvent.MOUSE_OVER)
            {
                this.setStyle("textFormat", GlobalStyle.textFormatHuang.center());
            }
            else
            {
                this.setStyle("textFormat", this._textFormat);
            }
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            this.enabled = param1["enabled"];
            return;
        }// end function

    }
}
